﻿using System.Windows;
using System.Windows.Controls;

namespace Bookvar.UI
{
    public class CloseableTabControl : TabControl
    {
    	private int currentItemsCount = 1;
        protected override DependencyObject GetContainerForItemOverride()
        {
            CloseableTabItem tabItem = new CloseableTabItem();
            tabItem.Index = currentItemsCount++;
//
//            Binding binding = new Binding("Index");
//            binding.Source = tabItem;
//            binding.Converter = IndexToBrushConverter.Instance;
//
//            tabItem.SetBinding(TabItem.BackgroundProperty, binding);

			
            return tabItem;
        }

        protected override bool IsItemItsOwnContainerOverride( object item )
        {
            return item is CloseableTabItem;
        }
    }
}
